package com.dongdong.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdong.mapper.TbBrandMapper;
import com.dongdong.pojo.TbBrand;
import com.dongdong.service.BeandService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
@org.springframework.stereotype.Service
public class BrandServiceImpl implements BeandService {

    @Autowired
    private TbBrandMapper tbBrandMapper;

    @Override
    public List<TbBrand> select() {
        List<TbBrand> tbBrands = tbBrandMapper.selectByExample(null);
        return tbBrands;
    }

    @Override
    public boolean insert(TbBrand tbBrand) {
        int i = tbBrandMapper.insertSelective(tbBrand);
        return i > 0;
    }

    @Override
    public boolean delete(Long id) {
        int i = tbBrandMapper.deleteByPrimaryKey(id);
        return i > 0;
    }

    @Override
    public TbBrand selectId(Long id) {
        TbBrand tbBrand = tbBrandMapper.selectByPrimaryKey(id);
        return tbBrand;
    }

    @Override
    public boolean update(TbBrand tbBrand) {
        int i = tbBrandMapper.updateByPrimaryKeySelective(tbBrand);
        return i > 0;
    }

    @Override
    public List<TbBrand> selectAll() {
        List<TbBrand> tbBrandList = tbBrandMapper.selectByExample(null);
        return tbBrandList;
    }
}
